import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '分类名称',
    align:"center",
    dataIndex: 'name'
   },
   {
    title: '分类代码',
    align:"center",
    dataIndex: 'code'
   },
   {
    title: '分类描述',
    align:"center",
    dataIndex: 'description'
   },
   {
    title: '分类颜色',
    align:"center",
    dataIndex: 'color'
   },
   {
    title: '分类图标',
    align:"center",
    dataIndex: 'icon'
   },
   {
    title: '排序权重',
    align:"center",
    dataIndex: 'sortOrder'
   },
   {
    title: '状态(0:禁用,1:启用)',
    align:"center",
    dataIndex: 'status'
   },
   {
    title: '文章数量',
    align:"center",
    dataIndex: 'articleCount'
   },
   {
    title: '创建时间',
    align:"center",
    dataIndex: 'createdTime'
   },
   {
    title: '更新时间',
    align:"center",
    dataIndex: 'updatedTime'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '分类名称',
    field: 'name',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入分类名称!'},
          ];
     },
  },
  {
    label: '分类代码',
    field: 'code',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入分类代码!'},
          ];
     },
  },
  {
    label: '分类描述',
    field: 'description',
    component: 'Input',
  },
  {
    label: '分类颜色',
    field: 'color',
    component: 'Input',
  },
  {
    label: '分类图标',
    field: 'icon',
    component: 'Input',
  },
  {
    label: '排序权重',
    field: 'sortOrder',
    component: 'InputNumber',
  },
  {
    label: '状态(0:禁用,1:启用)',
    field: 'status',
    component: 'InputNumber',
  },
  {
    label: '文章数量',
    field: 'articleCount',
    component: 'InputNumber',
  },
  {
    label: '创建时间',
    field: 'createdTime',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
  {
    label: '更新时间',
    field: 'updatedTime',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  name: {title: '分类名称',order: 0,view: 'text', type: 'string',},
  code: {title: '分类代码',order: 1,view: 'text', type: 'string',},
  description: {title: '分类描述',order: 2,view: 'text', type: 'string',},
  color: {title: '分类颜色',order: 3,view: 'text', type: 'string',},
  icon: {title: '分类图标',order: 4,view: 'text', type: 'string',},
  sortOrder: {title: '排序权重',order: 5,view: 'number', type: 'number',},
  status: {title: '状态(0:禁用,1:启用)',order: 6,view: 'number', type: 'number',},
  articleCount: {title: '文章数量',order: 7,view: 'number', type: 'number',},
  createdTime: {title: '创建时间',order: 8,view: 'datetime', type: 'string',},
  updatedTime: {title: '更新时间',order: 9,view: 'datetime', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}